﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace HQPad.Models
{
    public class Invocation
    {
        public int InvocationID { get; set; }

        [ForeignKey("Rules")]
        public int RuleSetID { get; set; }
        public virtual RuleSet Rules { get; set; }

        [Display(Name = "Invocation name")]
        [Required(ErrorMessage = "A invocation name is required")]
        [MaxLength(50, ErrorMessage = "The invocation name is limited to 50 characters")]
        public string Name { get; set; }

        [Display(Name = "Unique invocation slug")]
        [Required(ErrorMessage = "A invocation slug is required")]
        [MaxLength(50, ErrorMessage = "The invocation slug is limited to 50 characters")]
        public string Slug { get; set; }

        public bool Deleted { get; set; }

        [Display(Name = "Last updated")]
        [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
        public DateTime? LastUpdated { get; set; }

        [Display(Name = "Last updated by")]
        public int? LastUpdatedByUserID { get; set; }

        [Display(Name = "Invocation description")]
        public string Description { get; set; }

        public string Range { get; set; }

        public string Duration { get; set; }

        public bool IsExtendable { get; set; }

        public bool IsCommon { get; set; }

        [Display(Name = "Invocation rank")]
        public int Rank { get; set; }

        [Required(ErrorMessage = "A invocation sphere is required")]
        [MaxLength(20, ErrorMessage = "The invocation sphere is limited to 20 characters")]
        [RegularExpression("Good|Neutral|Evil")]
        public string Sphere { get; set; }

        [MaxLength(50, ErrorMessage="The maximum group name is limited to 20 characters")]
        public string GroupName { get; set; }

        /// <summary>The url group name slug.</summary>
        [MaxLength(50, ErrorMessage = "The maximum group name slug is limited to 50 characters")]
        public string GroupSlug { get; set; }

        [MaxLength(50, ErrorMessage = "The maximum required group name is limited to 50 characters")]
        public string RequiredGroupName { get; set; }

        [MaxLength(50, ErrorMessage = "The maximum family name is limited to 50 characters")]
        public string Family { get; set; }

        public virtual ICollection<Guild> Guilds { get; set; }
    }
}